﻿using System.ComponentModel.Composition;
using MEF_Test.Contracts;
using MEF_Test.Subtitles;
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.Regions;

namespace MEF_Test.VideoRenderer.LocalVideoRenderer
{
    [Export(typeof(IVideoRendererViewModelFactory))]
    public class VideoRendererViewModelFactory : IVideoRendererViewModelFactory
    {
        private IPlaybackControlsViewFactory _playbackControlsViewFactory;
        private IEventAggregator _eventAggregator;

        [ImportingConstructor]
        public VideoRendererViewModelFactory(IPlaybackControlsViewFactory playbackControlsViewFactory, IEventAggregator eventAggregator)
        {
            _playbackControlsViewFactory = playbackControlsViewFactory;
            _eventAggregator = eventAggregator;
        }

        public IVideoRendererViewModel Create(IRegionManager regionManager, IBrowserNodeViewModel browserNodeViewModel, ISubtitleHandler selectedSubtitle)
        {
            return new VideoRendererViewModel(regionManager, browserNodeViewModel, selectedSubtitle, _playbackControlsViewFactory, _eventAggregator);
        }
    }
}